package com.example.mapper;

import com.example.pojo.Emp;
import org.apache.ibatis.annotations.*;

@Mapper
public interface EmpMapper {
    @Select("select * from emp where username = #{username}")
    Emp findByUsername(String username);

    @Insert("insert into emp (username, password, create_time, update_time) " +
            "values (#{username},#{password},now(),now())")
    void register(@Param("username") String username, @Param("password") String password);

    @Update("update emp set username = #{username},update_time = #{updateTime} where id = #{id}")
    void updateEmpInfo(Emp emp);

    @Update("update emp set user_pic = #{avatarUrl} where id = #{id};")
    void updateAvatar(@Param("avatarUrl") String avatarUrl, @Param("id") Integer id);

    @Update("update emp set password = #{rePwd} where id = #{id};")
    void updatePwd(@Param("rePwd") String rePwd,@Param("id") Integer id);
}
